ostbuild: Various fixes, removal of dead code
authorColin Walters <walters@verbum.org>
Tue, 15 May 2012 14:11:50 +0000 (10:11 -0400)
committerColin Walters <walters@verbum.org>
Fri, 18 May 2012 20:30:45 +0000 (16:30 -0400)
Makefile-ostbuild.am
src/ostbuild/pyostbuild/builtin_git_mirror.py
src/ostbuild/pyostbuild/builtin_privhelper_run_qemu.py
src/ostbuild/pyostbuild/builtin_resolve.py
src/ostbuild/pyostbuild/builtin_status.py [deleted file]
src/ostbuild/pyostbuild/builtins.py
src/ostbuild/pyostbuild/main.py

index 41fbbe236e85ec86dd3961214b653e53281d513c..4b6e04dbc5dd8ef3728fa46aad2c0a21f3a16774 100644 (file)
@@ -39,7 +39,6 @@ pyostbuild_PYTHON =                                   \
        src/ostbuild/pyostbuild/builtin_prefix.py       \
        src/ostbuild/pyostbuild/builtin_resolve.py      \
        src/ostbuild/pyostbuild/builtin_init.py \
-       src/ostbuild/pyostbuild/builtin_status.py       \
        src/ostbuild/pyostbuild/builtins.py             \
        src/ostbuild/pyostbuild/filemonitor.py          \
        src/ostbuild/pyostbuild/fileutil.py             \
index 687c0ead4a5295562158ea89005087cce7ca4706..34e239466127be5a7de6a34b8d583bdf8e9522e4 100755 (executable)
@@ -40,6 +40,7 @@ class OstbuildGitMirror(builtins.Builtin):
         parser = argparse.ArgumentParser(description=self.short_description)
         parser.add_argument('--prefix')
         parser.add_argument('--src-snapshot')
+        parser.add_argument('--start-at')
         parser.add_argument('--fetch', action='store_true')
         parser.add_argument('components', nargs='*')
 
@@ -51,6 +52,9 @@ class OstbuildGitMirror(builtins.Builtin):
             components = []
             for component in self.snapshot['components']:
                 components.append(component['name'])
+            if args.start_at:
+                idx = components.index(args.start_at)
+                components = components[idx:]
         else:
             components = args.components
 
index 7f069d1d7c4df126e65c236a9b5408f4a7121c22..a3e556e5751f158b8c8d537a73d3d4230d6cc52b 100755 (executable)
@@ -57,6 +57,7 @@ class OstbuildPrivhelperRunQemu(builtins.Builtin):
 
         args = [qemu, '-kernel', kernel, '-initrd', initramfs,
                 '-hda', self.qemu_path, '-m', memory, '-append', extra_args]
+        log("Running: %s" % (subprocess.list2cmdline(args), ))
         os.execvp(qemu, args)
         
 builtins.register(OstbuildPrivhelperRunQemu)
index d5b5fd580af742158f79a31de9838aa1a0c9d77e..0cff9d1df60def0932911053ae9d55591fe2f369 100755 (executable)
@@ -45,7 +45,7 @@ class OstbuildResolve(builtins.Builtin):
         orig_src = component_meta['src']
 
         did_expand = False
-        for (vcsprefix, expansion) in self.manifest['vcsconfig'].iteritems():
+        for (vcsprefix, expansion) in self.snapshot['vcsconfig'].iteritems():
             prefix = vcsprefix + ':'
             if orig_src.startswith(prefix):
                 result['src'] = expansion + orig_src[len(prefix):]
@@ -75,7 +75,6 @@ class OstbuildResolve(builtins.Builtin):
     def execute(self, argv):
         parser = argparse.ArgumentParser(description=self.short_description)
         parser.add_argument('--manifest', required=True)
-        parser.add_argument('--fetch', action='store_true')
         parser.add_argument('--fetch-patches', action='store_true')
         parser.add_argument('components', nargs='*')
 
@@ -84,35 +83,14 @@ class OstbuildResolve(builtins.Builtin):
         
         self.parse_config()
 
-        self.manifest = json.load(open(args.manifest))
-        self.prefix = self.manifest['prefix']
+        self.snapshot = json.load(open(args.manifest))
+        self.prefix = self.snapshot['prefix']
 
-        snapshot = copy.deepcopy(self.manifest)
-        components = map(self._resolve_component_meta, self.manifest['components'])
-        snapshot['components'] = components
+        components = map(self._resolve_component_meta, self.snapshot['components'])
+        self.snapshot['components'] = components
 
-        if args.fetch:
-            if len(args.components) == 0:
-                fetch_components = map(lambda x: x['name'], component_source_list)
-            else:
-                fetch_components = args.components
-            for component_name in fetch_components:
-                found = False
-                for component in components:
-                    if component['name'] == component_name:
-                        found = True
-                        break
-                if not found:
-                    fatal("Unknown component %r" % (component_name, ))
-                (keytype, uri) = vcs.parse_src_key(component['src'])
-                mirrordir = vcs.ensure_vcs_mirror(self.mirrordir, keytype, uri, None)
-                log("Running git fetch for %s" % (component['name'], ))
-                run_sync(['git', 'fetch'], cwd=mirrordir, log_initiation=False)
-        else:
-            fetch_components = []
-
-        global_patches_meta = self._resolve_component_meta(self.manifest['patches'])
-        snapshot['patches'] = global_patches_meta
+        global_patches_meta = self._resolve_component_meta(self.snapshot['patches'])
+        self.snapshot['patches'] = global_patches_meta
         (keytype, uri) = vcs.parse_src_key(global_patches_meta['src'])
         mirrordir = vcs.ensure_vcs_mirror(self.mirrordir, keytype, uri, global_patches_meta['branch'])
         if args.fetch_patches:
@@ -135,7 +113,7 @@ class OstbuildResolve(builtins.Builtin):
             component['revision'] = revision
 
         src_db = self.get_src_snapshot_db()
-        path = src_db.store(snapshot)
+        path = src_db.store(self.snapshot)
         log("Source snapshot: %s" % (path, ))
         
 builtins.register(OstbuildResolve)
diff --git a/src/ostbuild/pyostbuild/builtin_status.py b/src/ostbuild/pyostbuild/builtin_status.py
deleted file mode 100755 (executable)
index f4585d5..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (C) 2011,2012 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-# ostbuild-compile-one-make wraps systems that implement the GNOME build API:
-# http://people.gnome.org/~walters/docs/build-api.txt
-
-import os,sys,stat,subprocess,tempfile,re,shutil
-import argparse
-from StringIO import StringIO
-import json
-
-from . import builtins
-from .ostbuildlog import log, fatal
-from .subprocess_helpers import run_sync, run_sync_get_output
-from . import buildutil
-
-class OstbuildStatus(builtins.Builtin):
-    name = "status"
-    short_description = "Show build status"
-
-    def __init__(self):
-        builtins.Builtin.__init__(self)
-
-    def execute(self, argv):
-        parser = argparse.ArgumentParser(description=self.short_description)
-        parser.add_argument('--manifest', required=True)
-
-        args = parser.parse_args(argv)
-
-        self.parse_config()
-        self.parse_components_and_targets()
-
-        for name,component in self.components.iteritems():
-            buildname = 'components/%s' % (name, )
-            build_revision = run_sync_get_output(['ostree', '--repo=' + self.repo,
-                                                  'show',
-                                                  '--print-metadata-key=ostbuild-artifact-version',
-                                                  buildname],
-                                                 none_on_error=True)
-            if build_revision is None:
-                build_revision = '(not built)'
-            if build_revision != component['revision']:
-                build_status = '(needs build)'
-            else:
-                build_status = 'ok'
-            sys.stdout.write('{:<40} {:<95} {:<10}\n'.format(name,
-                                                             build_revision, build_status))
-    
-builtins.register(OstbuildStatus)
index 62a20b3d900ffa8caeac99fcbd27dc8931f8c309..e97c33cd3001530f5f1ebc7bd975685b7fc8db8b 100755 (executable)
@@ -123,7 +123,6 @@ class Builtin(object):
         return meta
 
     def get_component(self, name):
-        assert self.repo is not None
         assert self.snapshot is not None
         for component in self.snapshot['components']:
             if component['name'] == name:
index bf5ec94156e32d8046e0fa30cf22164fcc913fa0..58a6b01f35784c612de1164e14920124276d2ba1 100755 (executable)
@@ -29,17 +29,15 @@ from . import builtin_chroot_compile_one
 from . import builtin_compile_one
 from . import builtin_deploy_root
 from . import builtin_deploy_qemu
+from . import builtin_git_mirror
 from . import builtin_import_tree
+from . import builtin_init
 from . import builtin_run_qemu
-from . import builtin_git_mirror
-from . import builtin_pull_components
+from . import builtin_prefix
 from . import builtin_privhelper_deploy_qemu
 from . import builtin_privhelper_run_qemu
-from . import builtin_prefix
+from . import builtin_pull_components
 from . import builtin_resolve
-from . import builtin_modify_snapshot
-from . import builtin_init
-from . import builtin_status
 
 def usage(ecode):
     print "Builtins:"